package com.atguigu.gulimall.order.web;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.gulimall.order.domain.vo.AliPayNotifyResponse;
import com.atguigu.gulimall.order.service.OrderPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Author lhj
 * @Date 2024/5/26 18:08
 */
@Slf4j
@RestController
public class PayedNotifyController {
    
    @Autowired
    OrderPayService orderPayService;
    
    @PostMapping("/payed/notify")
    public String payedNotify(@RequestBody AliPayNotifyResponse notifyResponse) {
        log.info("payed callback parameters: {}", JSONObject.toJSONString(notifyResponse));
        return orderPayService.payedNotify(notifyResponse);
    }
    
}
